/**
 * @Title: 对账状态：1=未对账，2=已对账，3=待结算，4=已结算,默认值为未对账
 * @author fl
 * @date 2018年4月23日 11:40
 */

package com.example.jrfwcwgl.enums;

public enum DzStateEnum {

	WDZ("未对账", 1),
    YDZ("已对账", 2),
    DJS("待结算", 3),
    YJS("已结算", 4);

    private String name;
    private int index;

    private DzStateEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (DzStateEnum c : DzStateEnum.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static Integer getIndex(String name) {
        for (DzStateEnum c : DzStateEnum.values()) {
            if (c.getName().equals(name)) {
                return c.getIndex();
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
